package com.voltmao.webpro.utils.http;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by zhouyang on 2017/5/31.
 */
public class HttpResponseUtils {
    private static Log log = LogFactory.getLog(HttpRequestUtil.class);


    /**
     * 输出XML文本
     *
     * @param response
     * @param xml
     */
    public static void writerXml(HttpServletResponse response, String xml) {
        response.setCharacterEncoding("UTF-8");
        response.setContentType("text/xml;charset=UTF-8");

        try {
            PrintWriter out = response.getWriter();
            out.write(xml);
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
